package com.tanhua.dubbo.mappers;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.model.db.UserInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserInfoMapper extends BaseMapper<UserInfo> {

    /**
     * 查询黑名单的用户列表
     * 1.配置分页插件
     * 2.编写自定义的方法
     * 3.修改方法的返回值。在方法参数第一位上指定新参数Page
     */
    @Select("SELECT * from tb_user_info WHERE id in (\n" +
            "SELECT black_user_id from tb_black_list where user_id = #{userId}\n" +
            ")")
    IPage<UserInfo> findBlackList(@Param("page") Page<UserInfo> page,@Param("userId") Long userId);

}
